reload.sh

#!/bin/bash

# Put this in reload.sh & run `reload.sh` or `reload.sh y`. 
# & install xdotool
SHOULD_SWITCH_BACK=$1 # y/Y means it will switch back to current window
CURRENT_WINDOW=$(xdotool getactivewindow)
KEY="F5"
BROWSER="Firefox"

xdotool search --desktop 0 ${BROWSER} windowactivate
xdotool key ${KEY}
if [[ $SHOULD_SWITCH_BACK == 'y' || $SHOULD_SWITCH_BACK == 'Y' ]]; then
    xdotool windowfocus --sync ${CURRENT_WINDOW}
    xdotool windowactivate --sync ${CURRENT_WINDOW}
fi